package com.westos.userauth.dao.impl;

import com.westos.userauth.dao.PersonDao;
import com.westos.userauth.dao.mybatis.PersonDAO;
import com.westos.userauth.domain.Person;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class MybatisPersonDao implements PersonDao {

    @Autowired
    private PersonDAO personDao;

    @Override
    public int deletePersonByPartyId(String partyId) {
        return personDao.deletePersonByPartyId(partyId);
    }

    @Override
    public int updatePerson(Person person) {
        return personDao.updatePerson(person, person.getPartyId());
    }

    @Override
    public boolean insertPerson(Person person) {
        return personDao.insertPerson(person) > 0;
    }

    @Override
    public Person queryById(String partyId) {
        return personDao.queryById(partyId);
    }

    public PersonDAO getPersonDao() {
        return personDao;
    }

    public void setPersonDao(PersonDAO personDao) {
        this.personDao = personDao;
    }
}
